USE [HelpUs]
GO

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_usuOrganizacaoproblema]') AND parent_object_id = OBJECT_ID(N'[dbo].[premioSet_problemas]'))
ALTER TABLE [dbo].[premioSet_problemas] DROP CONSTRAINT [FK_usuOrganizacaoproblema]
GO

USE [HelpUs]
GO

/****** Object:  Table [dbo].[premioSet_problemas]    Script Date: 05/21/2012 22:43:26 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[premioSet_problemas]') AND type in (N'U'))
DROP TABLE [dbo].[premioSet_problemas]
GO

USE [HelpUs]
GO

/****** Object:  Table [dbo].[premioSet_problemas]    Script Date: 05/21/2012 22:43:26 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[premioSet_problemas](
	[idProb] [int] IDENTITY(1,1) NOT NULL,
	[descProb] [nvarchar](4000) NOT NULL,
	[tituloProb] [nvarchar](50) NOT NULL,
	[statusProb] [nvarchar](2) NOT NULL,
	[dtInicioProb] [Date] NOT NULL,
	[dtFimProb] [Date] NOT NULL,
	[midiasProb] [nvarchar](50) NOT NULL,
	[regraProb] [nvarchar](4000) NOT NULL,
	[idProblema] [int] NOT NULL,
	[usuOrganizacao_idEndereco] [int] NOT NULL,
	[idUsuOrganizacao_idOrg] [int] NOT NULL,
 CONSTRAINT [PK_premioSet_problemas] PRIMARY KEY CLUSTERED 
(
	[idProblema] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[premioSet_problemas]  WITH CHECK ADD  CONSTRAINT [FK_usuOrganizacaoproblema] FOREIGN KEY([idUsuOrganizacao_idOrg])
REFERENCES [dbo].[enderecoSet_usuOrganizacao] ([idOrg])
GO

ALTER TABLE [dbo].[premioSet_problemas] CHECK CONSTRAINT [FK_usuOrganizacaoproblema]
GO


